import Koa from 'koa'
import koaRouter from 'koa-router'
import KoaStatic from 'koa-static'


const HOST = process.env.HOST || '0.0.0.0'
const PORT = process.env.PORT || 8080



const app = new Koa();
const router = new koaRouter()
app.use(KoaStatic('./src/views'))
app.use(async (ctx,next)=>{
    //console.log('访问1:'+ctx.req.url)
    await next()
})
app.use(router.routes()).use(router.allowedMethods());

app.listen(8080,()=>{
    // let host = app.address().host;
    // let port = app.address().port;
    // console.log(app)
    // console.log(`服务器启动成功：${host}:${port}`)
})
